package netctoss.demo.mapper;

import org.apache.ibatis.jdbc.SQL;
import org.springframework.util.StringUtils;

import java.util.Map;

public class CostSqlProvider {

    public String selectPage(Map map) {
        return new SQL() {{
            SELECT("* ");
            FROM("cost ");
            if (map.containsKey("baseCost")&&!StringUtils.isEmpty("baseCost")){
                ORDER_BY("cost_base_cost desc");
            }
            if (map.containsKey("baseDuration")&&!StringUtils.isEmpty("baseDuration")){
                ORDER_BY("cost_base_duration desc");
            }
//            if (map.containsKey("costName")&&!StringUtils.isEmpty("costName")){
//                ORDER_BY("cost_name desc");
//            }

        }}.toString();
    }
}
